<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.9.1"/>
<title>opennars: nars.language.CompoundTerm.renameVariables</title>
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../jquery.js"></script>
<script type="text/javascript" src="../../dynsections.js"></script>
<link href="../../navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../resize.js"></script>
<script type="text/javascript" src="../../navtreedata.js"></script>
<script type="text/javascript" src="../../navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../search/searchdata.js"></script>
<script type="text/javascript" src="../../search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">opennars
   &#160;<span id="projectnumber">1.5.5</span>
   </div>
   <div id="projectbrief">1.5-ish</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.9.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="../../index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="../../pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="../../namespaces.html"><span>Packages</span></a></li>
      <li><a href="../../annotated.html"><span>Classes</span></a></li>
      <li><a href="../../files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="../../search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="../../search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('d0/dee/classnars_1_1language_1_1CompoundTerm_ac81d297c59bab29f9f4f0ab45ab64b4f.html','../../');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="contents">
<a class="anchor" id="ac81d297c59bab29f9f4f0ab45ab64b4f"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void nars.language.CompoundTerm.renameVariables </td>
          <td>(</td>
          <td class="paramtype">HashMap&lt; <a class="el" href="../../de/da5/classnars_1_1language_1_1Variable.html">Variable</a>, <a class="el" href="../../de/da5/classnars_1_1language_1_1Variable.html">Variable</a> &gt;&#160;</td>
          <td class="paramname"><em>map</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Rename the variables in the compound. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">map</td><td>The substitution established so far </td></tr>
  </table>
  </dd>
</dl>

<p>Definition at line <a class="el" href="../../d5/d0e/CompoundTerm_8java_source.html#l00517">517</a> of file <a class="el" href="../../d5/d0e/CompoundTerm_8java_source.html">CompoundTerm.java</a>.</p>

<p>References <a class="el" href="../../d5/d0e/CompoundTerm_8java_source.html#l00356">nars.language.CompoundTerm.componentAt()</a>, <a class="el" href="../../d5/d0e/CompoundTerm_8java_source.html#l00078">nars.language.CompoundTerm.CompoundTerm()</a>, <a class="el" href="../../d5/d0e/CompoundTerm_8java_source.html#l00497">nars.language.CompoundTerm.containVar()</a>, <a class="el" href="../../d8/df2/Term_8java_source.html#l00094">nars.language.Term.equals()</a>, <a class="el" href="../../d8/df2/Term_8java_source.html#l00068">nars.language.Term.getName()</a>, and <a class="el" href="../../d5/d0e/CompoundTerm_8java_source.html#l00234">nars.language.CompoundTerm.makeName()</a>.</p>
<div class="fragment"><div class="line"><a name="l00517"></a><span class="lineno">  517</span>&#160;                                                                 {</div>
<div class="line"><a name="l00518"></a><span class="lineno">  518</span>&#160;        <span class="keywordflow">if</span> (<a class="code" href="../../d0/dee/classnars_1_1language_1_1CompoundTerm_a18e066f782a0070b137132a6a2d732d6.html#a18e066f782a0070b137132a6a2d732d6">containVar</a>()) {</div>
<div class="line"><a name="l00519"></a><span class="lineno">  519</span>&#160;            <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; <a class="code" href="../../d0/dee/classnars_1_1language_1_1CompoundTerm_ad340d3bb55dcfcdf237fe4ee225d3cbb.html#ad340d3bb55dcfcdf237fe4ee225d3cbb">components</a>.size(); i++) {</div>
<div class="line"><a name="l00520"></a><span class="lineno">  520</span>&#160;                <a class="code" href="../../d8/db8/classnars_1_1language_1_1Term.html">Term</a> term = <a class="code" href="../../d0/dee/classnars_1_1language_1_1CompoundTerm_acedae916705e9fa1669391a7d728b840.html#acedae916705e9fa1669391a7d728b840">componentAt</a>(i);</div>
<div class="line"><a name="l00521"></a><span class="lineno">  521</span>&#160;                <span class="keywordflow">if</span> (term instanceof Variable) {</div>
<div class="line"><a name="l00522"></a><span class="lineno">  522</span>&#160;                    Variable var;</div>
<div class="line"><a name="l00523"></a><span class="lineno">  523</span>&#160;                    <span class="keywordflow">if</span> (term.<a class="code" href="../../d8/db8/classnars_1_1language_1_1Term_a3aad4654016b8615fd4fa8a26668e1db.html#a3aad4654016b8615fd4fa8a26668e1db">getName</a>().length() == 1) { <span class="comment">// anonymous variable from input</span></div>
<div class="line"><a name="l00524"></a><span class="lineno">  524</span>&#160;                        var = <span class="keyword">new</span> Variable(term.<a class="code" href="../../d8/db8/classnars_1_1language_1_1Term_a3aad4654016b8615fd4fa8a26668e1db.html#a3aad4654016b8615fd4fa8a26668e1db">getName</a>().charAt(0) + <span class="stringliteral">&quot;&quot;</span> + (map.size() + 1));</div>
<div class="line"><a name="l00525"></a><span class="lineno">  525</span>&#160;                    } <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00526"></a><span class="lineno">  526</span>&#160;                        var = (Variable) map.get((Variable) term);</div>
<div class="line"><a name="l00527"></a><span class="lineno">  527</span>&#160;                        <span class="keywordflow">if</span> (var == null) {</div>
<div class="line"><a name="l00528"></a><span class="lineno">  528</span>&#160;                            var = <span class="keyword">new</span> Variable(term.getName().charAt(0) + <span class="stringliteral">&quot;&quot;</span> + (map.size() + 1));</div>
<div class="line"><a name="l00529"></a><span class="lineno">  529</span>&#160;                        }</div>
<div class="line"><a name="l00530"></a><span class="lineno">  530</span>&#160;                    }</div>
<div class="line"><a name="l00531"></a><span class="lineno">  531</span>&#160;                    <span class="keywordflow">if</span> (!term.equals(var)) {</div>
<div class="line"><a name="l00532"></a><span class="lineno">  532</span>&#160;                        <a class="code" href="../../d0/dee/classnars_1_1language_1_1CompoundTerm_ad340d3bb55dcfcdf237fe4ee225d3cbb.html#ad340d3bb55dcfcdf237fe4ee225d3cbb">components</a>.set(i, var);</div>
<div class="line"><a name="l00533"></a><span class="lineno">  533</span>&#160;                    }</div>
<div class="line"><a name="l00534"></a><span class="lineno">  534</span>&#160;                    map.put((Variable) term, var);</div>
<div class="line"><a name="l00535"></a><span class="lineno">  535</span>&#160;                } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (term instanceof <a class="code" href="../../d0/dee/classnars_1_1language_1_1CompoundTerm.html">CompoundTerm</a>) {</div>
<div class="line"><a name="l00536"></a><span class="lineno">  536</span>&#160;                    ((<a class="code" href="../../d0/dee/classnars_1_1language_1_1CompoundTerm_a89000afae8017231889aaa549292d1e0.html#a89000afae8017231889aaa549292d1e0">CompoundTerm</a>) term).renameVariables(map);</div>
<div class="line"><a name="l00537"></a><span class="lineno">  537</span>&#160;                    ((<a class="code" href="../../d0/dee/classnars_1_1language_1_1CompoundTerm_a89000afae8017231889aaa549292d1e0.html#a89000afae8017231889aaa549292d1e0">CompoundTerm</a>) term).setName(((CompoundTerm) term).<a class="code" href="../../d0/dee/classnars_1_1language_1_1CompoundTerm_aa26a304f6249c185836d8fde8b8f17a8.html#aa26a304f6249c185836d8fde8b8f17a8">makeName</a>());</div>
<div class="line"><a name="l00538"></a><span class="lineno">  538</span>&#160;                }</div>
<div class="line"><a name="l00539"></a><span class="lineno">  539</span>&#160;            }</div>
<div class="line"><a name="l00540"></a><span class="lineno">  540</span>&#160;        }</div>
<div class="line"><a name="l00541"></a><span class="lineno">  541</span>&#160;    }</div>
<div class="ttc" id="classnars_1_1language_1_1Term_a3aad4654016b8615fd4fa8a26668e1db_html_a3aad4654016b8615fd4fa8a26668e1db"><div class="ttname"><a href="../../d8/db8/classnars_1_1language_1_1Term_a3aad4654016b8615fd4fa8a26668e1db.html#a3aad4654016b8615fd4fa8a26668e1db">nars.language.Term.getName</a></div><div class="ttdeci">String getName()</div><div class="ttdoc">Reporting the name of the current Term. </div><div class="ttdef"><b>Definition:</b> <a href="../../d8/df2/Term_8java_source.html#l00068">Term.java:68</a></div></div>
<div class="ttc" id="classnars_1_1language_1_1CompoundTerm_aa26a304f6249c185836d8fde8b8f17a8_html_aa26a304f6249c185836d8fde8b8f17a8"><div class="ttname"><a href="../../d0/dee/classnars_1_1language_1_1CompoundTerm_aa26a304f6249c185836d8fde8b8f17a8.html#aa26a304f6249c185836d8fde8b8f17a8">nars.language.CompoundTerm.makeName</a></div><div class="ttdeci">String makeName()</div><div class="ttdoc">default method to make the oldName of the current term from existing fields </div><div class="ttdef"><b>Definition:</b> <a href="../../d5/d0e/CompoundTerm_8java_source.html#l00234">CompoundTerm.java:234</a></div></div>
<div class="ttc" id="classnars_1_1language_1_1CompoundTerm_a89000afae8017231889aaa549292d1e0_html_a89000afae8017231889aaa549292d1e0"><div class="ttname"><a href="../../d0/dee/classnars_1_1language_1_1CompoundTerm_a89000afae8017231889aaa549292d1e0.html#a89000afae8017231889aaa549292d1e0">nars.language.CompoundTerm.CompoundTerm</a></div><div class="ttdeci">CompoundTerm()</div><div class="ttdoc">Default constructor. </div><div class="ttdef"><b>Definition:</b> <a href="../../d5/d0e/CompoundTerm_8java_source.html#l00078">CompoundTerm.java:78</a></div></div>
<div class="ttc" id="classnars_1_1language_1_1Term_html"><div class="ttname"><a href="../../d8/db8/classnars_1_1language_1_1Term.html">nars.language.Term</a></div><div class="ttdoc">Term is the basic component of Narsese, and the object of processing in NARS. </div><div class="ttdef"><b>Definition:</b> <a href="../../d8/df2/Term_8java_source.html#l00040">Term.java:40</a></div></div>
<div class="ttc" id="classnars_1_1language_1_1CompoundTerm_a18e066f782a0070b137132a6a2d732d6_html_a18e066f782a0070b137132a6a2d732d6"><div class="ttname"><a href="../../d0/dee/classnars_1_1language_1_1CompoundTerm_a18e066f782a0070b137132a6a2d732d6.html#a18e066f782a0070b137132a6a2d732d6">nars.language.CompoundTerm.containVar</a></div><div class="ttdeci">boolean containVar()</div><div class="ttdoc">Whether this compound term contains any variable term. </div><div class="ttdef"><b>Definition:</b> <a href="../../d5/d0e/CompoundTerm_8java_source.html#l00497">CompoundTerm.java:497</a></div></div>
<div class="ttc" id="classnars_1_1language_1_1CompoundTerm_ad340d3bb55dcfcdf237fe4ee225d3cbb_html_ad340d3bb55dcfcdf237fe4ee225d3cbb"><div class="ttname"><a href="../../d0/dee/classnars_1_1language_1_1CompoundTerm_ad340d3bb55dcfcdf237fe4ee225d3cbb.html#ad340d3bb55dcfcdf237fe4ee225d3cbb">nars.language.CompoundTerm.components</a></div><div class="ttdeci">ArrayList&lt; Term &gt; components</div><div class="ttdoc">list of (direct) components </div><div class="ttdef"><b>Definition:</b> <a href="../../d5/d0e/CompoundTerm_8java_source.html#l00039">CompoundTerm.java:39</a></div></div>
<div class="ttc" id="classnars_1_1language_1_1CompoundTerm_acedae916705e9fa1669391a7d728b840_html_acedae916705e9fa1669391a7d728b840"><div class="ttname"><a href="../../d0/dee/classnars_1_1language_1_1CompoundTerm_acedae916705e9fa1669391a7d728b840.html#acedae916705e9fa1669391a7d728b840">nars.language.CompoundTerm.componentAt</a></div><div class="ttdeci">Term componentAt(int i)</div><div class="ttdoc">get a component by index </div><div class="ttdef"><b>Definition:</b> <a href="../../d5/d0e/CompoundTerm_8java_source.html#l00356">CompoundTerm.java:356</a></div></div>
<div class="ttc" id="classnars_1_1language_1_1CompoundTerm_html"><div class="ttname"><a href="../../d0/dee/classnars_1_1language_1_1CompoundTerm.html">nars.language.CompoundTerm</a></div><div class="ttdoc">A CompoundTerm is a Term with internal (syntactic) structure. </div><div class="ttdef"><b>Definition:</b> <a href="../../d5/d0e/CompoundTerm_8java_source.html#l00036">CompoundTerm.java:36</a></div></div>
</div><!-- fragment -->
<p><div id="dynsection-0" onclick="return toggleVisibility(this)" class="dynheader closed" style="cursor:pointer;">
  <img id="dynsection-0-trigger" src="../../closed.png" alt="+"/> Here is the call graph for this function:</div>
<div id="dynsection-0-summary" class="dynsummary" style="display:block;">
</div>
<div id="dynsection-0-content" class="dyncontent" style="display:none;">
<div class="center"><div class="zoom"><iframe scrolling="no" frameborder="0" src="../../d0/dee/classnars_1_1language_1_1CompoundTerm_ac81d297c59bab29f9f4f0ab45ab64b4f_ac81d297c59bab29f9f4f0ab45ab64b4f_cgraph.svg" width="100%" height="540"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
</div>
</div>
</p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="../../d7/d81/namespacenars.html">nars</a></li><li class="navelem"><a class="el" href="../../d0/d72/namespacenars_1_1language.html">language</a></li><li class="navelem"><a class="el" href="../../d0/dee/classnars_1_1language_1_1CompoundTerm.html">CompoundTerm</a></li>
    <li class="footer">Generated on Sun Jan 10 2016 18:03:59 for opennars by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="../../doxygen.png" alt="doxygen"/></a> 1.8.9.1 </li>
  </ul>
</div>
</body>
</html>
